(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=LA (Andrey Lukyanov) (l_a@hotmail.ru)
Title=Kinokabra
Description=Imports russian movies info with picture from Kinokabra.ru
Site=http://kinokabra.ru/
Language=RU
Version=1.01 (27.03.2005)
Requires=3.5.0
Comments=
License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
GetInfo=1
[Options]
***************************************************)
program KinoKabra;
const
BaseAddress = 'http://kinokabra.ru/';
var
MovieName: string;
TempStr: string;
function ParseURL(Text:String):String;
var
BeginPos : Integer;
EndPos : Integer;
Value : String;
begin
repeat
BeginPos := Pos('',Text);
If BeginPos > 0 Then
Begin
EndPos := Pos('',Text);
Value := copy(Text, BeginPos, EndPos - BeginPos);
Value := StringReplace(Value,'
',', ');
Value := StringReplace(Value,'
',', ');
HTMLRemoveTags(Value);
Delete(Text,1,EndPos);
If Length(result)>0 Then
result := result + ', ' + Value
else
result := Value;
end;
until BeginPos < 1;
end;
function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
i: Integer;
begin
result := -1;
if StartAt < 0 then
StartAt := 0;
for i := StartAt to List.Count-1 do
if Pos(AnsiLowerCase(Pattern), AnsiLowerCase(List.GetString(i))) <> 0 then
begin
result := i;
Break;
end;
end;
procedure AnalyzePage(Address: string);
var
ID, FilmName, Line: String;
Page: TStringList;
FilmPage: TStringList;
BeginPos, EndPos, LineBeginPos: Integer;
begin
Page := TStringList.Create;
// Page.SaveToFile('c:\page.txt'); // для отладки
// Page.LoadFromFile('c:\page.txt');
Page.Text := GetPage(Address);
PickTreeClear; // Очистка дерева фильмов
PickTreeAdd('Результаты поиска фильма: ' + MovieName, '');
LineBeginPos := 0;
repeat
BeginPos := FindLine('